<%@ page language="java" pageEncoding="utf-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<title>填写请假单</title>
<script type="text/javascript">
    function getDays(endElement) {
        var beginElement = document.getElementsByName("applicationBegin");
        var begintime = beginElement[0].value;
        var beginDate = new Date(begintime);
        console.log("开始时间time："+begintime);
        console.log("开始时间date："+beginDate);
        var endtime = endElement.value;
        var endDate = new Date(endtime);
        console.log("结束时间time："+endtime);
        console.log("结束时间date："+endDate);
        var days = parseInt(endDate-beginDate)/(1000*60*60*24);
        console.log("相差时间："+days+"天");
        var datenumberElement = document.getElementById("datenumber");
        datenumberElement.value = days;

    }

</script>
</head>
<body>
  <h3>添加请假单基本信息</h3>
  <form action="${pageContext.request.contextPath }/applicationHandler/addApplication.do" method="post">
  <fieldset>     <!--分组标签-->
     <legend>请假单基本信息</legend>  <!--设置标题-->
     <%-- <label for="applicationusername">请假者：</label>--%>
      请假者：<input type="text" name='applicationusername' readonly="readonly"  value="${userLogin.userName }"/><br/>
     <%--<label for="applicationcontent">请假事项：</label>--%>
      请假事项：<input type="text" name='applicationContent'><br/>
     <%--<label for="begintime">开始时间：</label>--%>
      开始时间：<input type="date" name='applicationBegin'><br/>
     <%--<label for="endtime">结束时间：</label>--%>
      结束时间：<input type="date" name='applicationEnd' onblur="getDays(this)"> <br/>
     <%--<label for="datenumber">请假天数：</label>--%>
      请假天数：<input type="text" id='datenumber' readonly="readonly"> <br/>
     <%--<label for="approve">审批者：</label>--%>
     审批者：
     <select name='selectapprovaluser'>
         <option value="0">----请选择----</option>
         <c:forEach var="user" items="${approvalUserInfo}">
             <option value=${user.userName}>${user.userName}</option>
         </c:forEach>

     </select>
     <br/>
     <input type="submit" value='生成请假单'>
     <input type="reset" value='清空'>
  </fieldset>
  </form>

</body>
</html>